@echo off
echo ==========================================
echo 未使用导入和变量修复工具
echo ==========================================

cd %~dp0..

echo 正在检查未使用的导入和变量...
npx eslint src/views/**/*.vue --quiet --max-warnings=0 --rule "@typescript-eslint/no-unused-vars: error, no-unused-vars: error" > unused-vars.txt

echo 生成统计报告...
echo 未使用的导入和变量报告 > unused-report.txt
echo 生成时间: %date% %time% >> unused-report.txt
echo ==========================================>> unused-report.txt
echo. >> unused-report.txt

type unused-vars.txt | findstr /C:"'is defined but never used" >> unused-report.txt

echo. >> unused-report.txt
echo ==========================================>> unused-report.txt
echo 修复建议: >> unused-report.txt
echo. >> unused-report.txt
echo 1. 移除未使用的导入: >> unused-report.txt
echo    import { 使用的部分 } from "模块路径"; >> unused-report.txt
echo. >> unused-report.txt
echo 2. 保留但标记为未使用: >> unused-report.txt
echo    import { x as _x } from "模块路径"; >> unused-report.txt
echo. >> unused-report.txt
echo 3. 注释未使用的导入: >> unused-report.txt
echo    // import { unused } from "模块路径"; >> unused-report.txt
echo. >> unused-report.txt

echo 未使用的导入/变量报告已生成: unused-report.txt
echo ========================================== 